package Charpter01;
import java.util.Scanner;
public class Charter_Excepton02 {
    static private float sum;
    static float Calculater(float a, char ch ,float b)
            throws NumberFormatException,ArithmeticException{
        switch(ch)
        {
            case '*':
                sum = a*b;
                break;
            case '/':
                sum =a/b;
                break;
            case '+':
                sum = a+b ;
                break;
            case '-':
                sum=a - b;
                break;
            default:
                throw new NumberFormatException("符号输入错误");
        }
        return sum;
    }
    public static void  main(String[] args)
    {
        float number1,number2,total;
        char ch;
        Scanner in = new Scanner(System.in);
        try {
            number1 = in.nextFloat();
            number2 = in.nextFloat();
            ch = in.next().charAt(0);
            total = Calculater(number1,ch,number2);
            System.out.println(total);
        }catch(NumberFormatException e){
            System.out.println("符号输入错误");
        }catch(ArithmeticException e ){
            System.out.println("算法错误");
        }finally {
            System.out.println("结束");
        }

    }
}
